﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入第一个数字：");
            string x = Console.ReadLine();
            Console.WriteLine("请输入第二个数字：");
            string y = Console.ReadLine();
            double num1 = Convert.ToDouble(x);
            double num2 = Convert.ToDouble(y);
            Console.WriteLine("请输入运算符：");
            string z = Console.ReadLine();
            double res;
            switch (z)
            {
                case "+":
                    res = num1 + num2;
                    Console.WriteLine("计算结果为{0}", res);
                    break;
                case "-":
                    res = num1 - num2;
                    Console.WriteLine("计算结果为{0}", res);
                    break;
                case "*":
                    res = num1 * num2;
                    Console.WriteLine("计算结果为{0}", res);
                    break;
                case "/":
                    if (num2 == 0) Console.WriteLine("除数不能为0 无法计算");
                    else
                    {
                        res = num1 / num2;
                        Console.WriteLine("计算结果为{0}", res);
                    }
                    break;
                default:
                    Console.WriteLine("你的输入有误 无法计算");
                    break;
            }

        }
    }
}
